package strategy;

/**
 * 返现策略
 **/
public class CashReturn implements ICashSuper {

	//返现底限金额
	private double moneyCondition;
	//返现金额
	private double returnMoney;

	public CashReturn(double moneyCondition, double returnMoney) {

		this.moneyCondition = moneyCondition;
		this.returnMoney = returnMoney;
	}

	//多重返利
	@Override
	public double acceptCash(double money) {

		if (money >= moneyCondition) {
			return money - Math.floor(money / moneyCondition) * returnMoney;
		}
		return 0;
	}

}
